package com.fg.cloud.manager.service.factory.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.fg.cloud.manager.entry.BaseEntity;
import com.fg.cloud.manager.entry.factory.FactoryParamsEntity;
import com.fg.cloud.manager.mapper.BaseMapper;
import com.fg.cloud.manager.mapper.factory.FactoryParamsMapper;
import com.fg.cloud.manager.service.BaseServiceImpl;
import com.fg.cloud.manager.service.factory.FactoryParamsService;

/**
  * Description:厂商参数Service-impl
  * @author shaoqiping
  * @date 2017年8月3日上午9:33:06
*/
@Service
public class FactoryParamsServiceImpl extends BaseServiceImpl implements FactoryParamsService {

	@Resource
	private FactoryParamsMapper paramsMapper;
	
	@Override
	protected <T extends BaseEntity> BaseMapper getBaseMapper() {
		return paramsMapper;
	}

	@Transactional
	public boolean insertSelective(FactoryParamsEntity record) {
		if(record.getContact()==null){
			record.setContact("");
		}
		if(record.getContactbar()==null){
			record.setContactbar("");
		}
		return paramsMapper.insertSelective(record) > 0 ? true : false;
	}

	@Transactional
	public boolean updateByPrimaryKeySelective(FactoryParamsEntity record) {
		return paramsMapper.updateByPrimaryKeySelective(record) > 0 ? true : false;
	}

	public FactoryParamsEntity selectByPrimaryKey(Long facId) {
		return paramsMapper.select(facId);
	}

	@Override
	public FactoryParamsEntity selectByFacId(Long id) {
		return paramsMapper.select(id);
	}

}
